home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / r / rexx_plus_compiler / rexxpluscompiler2.dms / in.adf / Examples / examples.zoo / grepall.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1991-11-01  |  1.1 KB  |  63 lines

  1. /* */
  2. signal on break_c
  3. signal on syntax
  4. signal on error
  5. signal on failure
  6. signal on ioerr
  7.  
  8. address command
  9. parse upper arg opt value name
  10.  
  11. if ~show('L',"rexxsupport.library") then
  12.    call addlib "rexxsupport.library",0,-30
  13.    
  14. if ~show('L',"rexxmathlib.library") then
  15.    call addlib "rexxmathlib.library",0,-30
  16.  
  17. parse value name with path':'name .
  18. if name = '' 
  19. then do
  20.     name = path
  21.     path = ''
  22.     end
  23. if path ~= '' then path = path':'
  24. cnt = lastpos('/',name)
  25. if cnt ~= 0
  26. then do
  27.     path = path||substr(name,1,cnt)
  28.     name = substr(name,cnt+1)
  29.     end
  30.  
  31. work = name
  32. do while work ~= ''
  33.     parse value work with name'/'work
  34.     if name ~= '' & work ~= ''
  35.     then
  36.         path = path||name'/'
  37.     end
  38. trace r?
  39. list = getlist()
  40.  
  41. parse value list with path list
  42. do while path ~= ''
  43.     'grep >ram:test2' opt value path||name
  44.         parse value list with path list
  45.     'join ram:test2 ram:test to ram:test3'
  46.     'delete ram:test2 ram:test'
  47.     'rename ram:test3 ram:test'
  48.         end
  49.  
  50. exit
  51.  
  52. getlist: procedure expose path
  53.     parse arg extra
  54.  
  55.     list = ''
  56.     dir = showdir(path||extra,'D')
  57.     do while dir ~= ''
  58.         parse var dir curr dir
  59.             list = list getlist(extra||curr'/')
  60.         end
  61.  
  62.     return list
  63.